package com.yonyou.cyxdms.sysAuth.service.entity;

import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import com.yonyou.cyxdms.framework.bean.entity.base.DMSBasePO;
import com.baomidou.mybatisplus.annotation.Version;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableField;

import java.io.Serializable;
import com.yonyou.cyx.function.utils.bean.BeanMapperUtil;
import com.yonyou.cyx.framework.bean.dto.base.BaseDTO;

/**
 * <p>
 * 受控权限表
 * </p>
 *
 * @author quankk
 * @since 2019-07-05
 */
@TableName("tm_permission_ctrl")
public class PermissionCtrlPO extends DMSBasePO<PermissionCtrlPO> {

    private static final long serialVersionUID = 1L;

    /**
     * 受控权限id
     */
        @TableId(value = "PERMISSION_CTRL_ID", type = IdType.AUTO)
        private Integer permissionCtrlId;
    /**
     * 权限类型，用于区分哪个的权限，例（用户权限，职位权限，角色权限）
     */
    @TableField("PERMISSION_TYPE")
    private Integer permissionType;

    @TableField("APP_ID")
    private String appId;
    /**
     * 权限id
     */
    @TableField("PERMISSION_ID")
    private Integer permissionId;
    /**
     * 控制类型(使用1042 进行关联)
     */
    @TableField("TYPE")
    private Integer type;
    /**
     * 控制代码
     */
    @TableField("CTRL_CODE")
    private String ctrlCode;
    /**
     * 是否柔性
     */
    @TableField("IS_FLEXIBLE")
    private Integer isFlexible;
    /**
     * 默认权限
     */
    @TableField("IS_EMPOWERED")
    private Integer isEmpowered;

    public PermissionCtrlPO() {
        super();
    }

    public String getAppId() {
        return appId;
    }

    public void setAppId(String appId) {
        this.appId = appId;
    }

    public Integer getPermissionCtrlId() {
        return permissionCtrlId;
    }

    public void setPermissionCtrlId(Integer permissionCtrlId) {
        this.permissionCtrlId = permissionCtrlId;
    }

    public Integer getPermissionType() {
        return permissionType;
    }

    public void setPermissionType(Integer permissionType) {
        this.permissionType = permissionType;
    }

    public Integer getPermissionId() {
        return permissionId;
    }

    public void setPermissionId(Integer permissionId) {
        this.permissionId = permissionId;
    }

    public Integer getType() {
        return type;
    }

    public void setType(Integer type) {
        this.type = type;
    }

    public String getCtrlCode() {
        return ctrlCode;
    }

    public void setCtrlCode(String ctrlCode) {
        this.ctrlCode = ctrlCode;
    }

    public Integer getIsFlexible() {
        return isFlexible;
    }

    public void setIsFlexible(Integer isFlexible) {
        this.isFlexible = isFlexible;
    }

    public Integer getIsEmpowered() {
        return isEmpowered;
    }

    public void setIsEmpowered(Integer isEmpowered) {
        this.isEmpowered = isEmpowered;
    }

    @Override
    protected Serializable pkVal() {
        return this.permissionCtrlId;
    }

    @Override
    public String toString() {
        return "PermissionCtrlPO{" +
                "permissionCtrlId=" + permissionCtrlId +
                ", permissionType=" + permissionType +
                ", appId='" + appId + '\'' +
                ", permissionId=" + permissionId +
                ", type=" + type +
                ", ctrlCode='" + ctrlCode + '\'' +
                ", isFlexible=" + isFlexible +
                ", isEmpowered=" + isEmpowered +
                '}';
    }

    /**
     * 将PO 信息转化为DTO
     *
     * @param dto 需要进行转换的dto
     * @author quankk
     * @since 2018/7/22 0022
     */
    protected <T extends BaseDTO> void transDtoToPo(T dto) {
        BeanMapperUtil.copyProperties(this, dto, "permissionCtrlId");
    }


}
